package String.stringbase;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        String userName="admin";
        String passWord="123456";
        Scanner sc=new Scanner(System.in);
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名：");
            String scuser=sc.nextLine();
            System.out.println("请输入密码：");
            String scpass=sc.nextLine();
            if (scuser.equals(userName)&&scpass.equals(passWord)){
                System.out.println("登陆成功");
                break;
            }else{
                if (i==3){
                    System.out.println("今日登陆次数过多，请明日再来。");
                }else{
                    System.out.println("登录失败，您还剩"+(3-i)+"次机会");
                }

            }
        }

    }
}
